import React, { useEffect, useState } from "react";
import http from "../../utils/http";

import "./index.scss";

export default function Films() {
  const [list, setList] = useState([]);

  useEffect(() => {
    function getData() {
      http.get("/films").then((response) => {
        setList(response.data);
      });
    }

    getData();
  }, []);

  return (
    <div className="films">
      <h1 className="a">电影页面</h1>
      <ul>
        {list.map((item) => (
          <li key={item.id}>{item.name}</li>
        ))}
      </ul>
    </div>
  );
}
